package pzl.kt.study.base

import org.junit.Test

class KT_String_Char {

    val str = "Kotlin 由 JetBrains 在 2010 年开发,2011 年开源了: https://github.com/JetBrains/k2"

    @Test
    fun test() {
        println(str.count())
        println(str.isEmpty())
        println(str.length)
        println(str.get(7))
        println(str[7])
        println(str.elementAt(7))
        println(str.first())
        println(str.last())
        println(str.substring(7))
        println(str.substring(4, 5))
        println(str.indices)

        println(str.toCharArray().forEach {
            print(it)
            print(" , ")
        })
    }

    @Test
    fun testChar() {
        var c = '尼'
        var d = '5'
        println("isDigit " + d.isDigit())
        println("isLetter " + c.isLetter())

        println(c + 1)
        println(d + 1)

        //unicode
        println(c.toInt())
    }

}